<template>
  <div class="containerMain">
    <el-row :gutter="40" class="panel-group">
      <el-col v-for="(item,index) in homeData" :key="index" :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div v-if="homeData.length" class="card-panel" @click="handleSetLineChartData('newVisitis')">
          <div class="card-panel-icon-wrapper icon-people">
            <div>卡来源</div>
            <span>{{ item.cardSource }}</span>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              总入库：{{ item.StockInCount }}
            </div>
            <div class="card-panel-text">
              已出库：{{ item.StockInCount -item.StockOutCount }}

            </div>
            <div class="card-panel-text">
              库存：{{ item.StockOutCount }}

            </div>
          </div>
        </div>
      </el-col>
      <div v-if="!homeData.length" class="emptyShow">暂无数据,请添加数据</div>
    </el-row>
  </div>
</template>

<script>
import { getHomeAlldata } from '@/api/home'
export default {
  components: {

  },
  data() {
    return {
      homeData: []
    }
  },
  created() {
    this.getHomeList()
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    },
    getHomeList() {
      getHomeAlldata().then(res => {
        if (res.code === '00000') {
          this.homeData = res.data
        } else {
          this.$message.error('请求错误')
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.chart-container{
  position: relative;
  width: 100%;
  height: calc(100vh - 84px);
}
.containerMain{
  .emptyShow{
    color: #666;
    font-size:20px;
}
}

.panel-group {
  margin-top: 18px;
  height: 100%;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    cursor: pointer;
    padding: 26px;
    justify-content:space-around;
    align-items: center;
    display: flex;
    font-size: 14px;
     font-weight: 600;
    position: relative;
    overflow: hidden;
    color: #f00;
    background: #f2f2f2;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
     .icon-people {
      color: #f00;
    }

    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      transition: all 0.38s ease-out;
      border-radius: 6px;
      color: #666;

    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      font-size: 14px;
      .card-panel-text {
        line-height: 18px;
        color: #666;
        font-weight: 600;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
